package thread;

/**
 * Created by qq65827 on 2015/2/3.
 */
public   class Counter {

    public volatile static int cout = 0;

    public static void inc() {
        Object object = new Object();
        synchronized (object) {
            try {
                Thread.sleep(1);
                System.out.println("now the count is" + cout);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            cout++;
        }

    }
}
